package com.wilmar.controller;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;

import com.wilmar.annotation.TargetDataSource;
import com.wilmar.mapper.UserMapper;
import com.wilmar.model.UserEntity;
/**
 * @Title: StudentService.java
 * @Package:com.gethub.service
 * @Description:这里用一句话描述这个类的作用
 * @date    2018年2月8日 上午11:03:04
 * @version V1.0
 */
//@RestController
public class UserController {

    // MyBatis的Mapper方法定义接口
    //为了简化demo就不写service层
    @Autowired
    private UserMapper userMapper;

    @TargetDataSource(name="ds2")
    @RequestMapping("/getUsers")
    public List<UserEntity> getUsers() {
        List<UserEntity> users=userMapper.getAll();
        return users;
    }
    
    @TargetDataSource(name="ds1")
    @RequestMapping("/getUser")
    public List<UserEntity> getUser(Long id) {
        List<UserEntity> users = userMapper.getAll();
        return users;
    }
    
    @RequestMapping("/getAllUser")
    public List<UserEntity> getAllUser(Long id) {
        List<UserEntity> users = userMapper.getAll();
        return users;
    }
}